import java.util.HashMap;
import java.util.Map;

class Solution1 {
    public int[] twoSum(int[] nums, int target) {
         int[] arr = new int[2]; 
         Map<Long,Integer> map = new HashMap<>() ;
         for(int i=0 ; i < nums.length ; i ++){
              long ret = target - nums[i] ; 
              if(map.containsKey(ret)){
                int a = map.get(ret) ; 
                arr[0] = a ;
                arr[1] = i ;
              }else{
                map.put((long)nums[i] , i) ; 
              }
         }
         return arr ;
    }
}